<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>视频</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
  <video controls width="800" poster="../images/cover.jpg" src="../video/纸船.mp4">您的浏览器不支持video标签</video>
  <button>开始</button>
  <button>暂停</button>
  <button>切换</button>
  <button>快进</button>
  <button>后退</button>
  <button>音量+</button>
  <button>音量-</button>
  <button>倍速播放</button>
  <audio src="../video/演员.mp3" controls></audio>
</body>
<script>
  $(function() {
    var video = $('video')[0]
    $('button').click(function() {
      switch ($(this).text()) {
        case '开始':
          video.play();
          break;
        case '暂停':
          video.pause();
          break;
        case '切换':
          // 当前状态是否暂停
          if(video.paused){
            video.play();
          } else {
            video.pause();
          }
          break;
        case '快进':
          video.currentTime += 5;
          break;
        case '后退':
          video.currentTime -= 5;
          break;
        case '音量+':
          if(video.volume >= 0.9 ){
            video.volume = 1
          } else {
            video.volume += 0.1
          }
          break;
        case '音量-':
          if(video.volume <= 0.1 ){
            video.volume = 0
          } else {
            video.volume -= 0.1
          }
          break;
        case '倍速播放':
          video.playbackRate = 2;
          break;
      }
    })
  })
</script>
</html>